package cn.thinkjoy.LawDataForExcel.service.Impl;

import cn.thinkjoy.LawDataForExcel.bean.ApunishNoticeInfo;
import cn.thinkjoy.LawDataForExcel.bean.Databean;
import cn.thinkjoy.LawDataForExcel.bean.PunishTypeInfo;
import cn.thinkjoy.LawDataForExcel.dao.ApunishNoticeInfoDao;
import cn.thinkjoy.LawDataForExcel.service.interfaces.ApunishNoticeInfoService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * Created by thinkjoy on 2017/6/20.
 */
@Service
public class ApunishNoticeInfoServiceImpl extends ServiceImpl<ApunishNoticeInfoDao,ApunishNoticeInfo> implements ApunishNoticeInfoService{

    @Autowired
    private ApunishNoticeInfoDao apunishNoticeInfoDao;

    public int saveApunishNoticeInfo(List<ApunishNoticeInfo> apunishNoticeInfos) {
        return apunishNoticeInfoDao.saveApunishNoticeInfo(apunishNoticeInfos);
    }

    @Override
    public List<ApunishNoticeInfo> findNoticesByDate(String effectDate) {
        try {
            return apunishNoticeInfoDao.findNoticesByDate(effectDate);
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public List<PunishTypeInfo> findPunishReasonByDate(String effectDate) {
        try {
            return apunishNoticeInfoDao.findPunishReasonByDate(effectDate);
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }

    }

    /**
     * 更改状态
     * @param apunishNoticeInfos
     * @return
     */
    @Override
    public int updateStatus(List<ApunishNoticeInfo> apunishNoticeInfos) {
        try {
            return apunishNoticeInfoDao.updateStatus(apunishNoticeInfos);
        }catch (Exception e){
            e.printStackTrace();
            return 0;
        }
    }
}
